package com.zzyl.nursing.job;

import com.zzyl.nursing.domain.DeviceData;
import com.zzyl.nursing.service.IDeviceDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("ColdAndHotTask")
public class ColdAndHotTask {

    @Autowired
    private IDeviceDataService deviceDataService;

    public void noParams(){
       List<DeviceData> data = deviceDataService.selectDeviceDataOverOneMinList();
        for (DeviceData datum : data) {
            deviceDataService.insertDeviceDataToCold(datum);
            Long id = datum.getId();
            deviceDataService.deleteDeviceDataById(id);
        }
    }
    //不占用内存的定时任务
    public void cleanDate(Integer min){
        deviceDataService.cleanDate(min);
    }
}
